<template>
  <div id="fu">
    <div id="left">
      <i class="el-icon-s-home"></i>
      <span>课程管理系统</span>
    </div>
    <div id="right">
      <el-avatar id="rightImg" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></el-avatar>
      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link" style="color: white;font-size: 18px">
          {{this.$store.getters.getUser.username}}<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="a">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
  export default {
    name: "Head",
    data() {
      return {
      }
    },
    methods:{
      handleCommand(){
        this.$store.dispatch('asyncUpdateToken','')
        this.$store.dispatch('asyncUpdateUser', '')
        location.reload()
      }
    }
  }
</script>

<style scoped>
  #left {
    float: left;
    font-size: 30px;
  }

  #left > span {
    margin-left: 15px;
    font-size: 24px;
  }

  #right {
    float: right;
    margin-right:25px ;
  }

  #right>span{
    color: white;
  }

  #rightImg{
    position: relative;
    top: 13px;
    left: -15px;
  }
</style>
